
<template>
	<el-dialog title="" visible :show-close="false" :append-to-body="true" class="wrap" >
		<i class="el-icon-close close" @click="cancel" style="color: white;z-index:10;"></i>
	    <div class="bt">领取</div>
		<el-form label-width="100px" class="form">
			<p>是否确定领取物品吗？</p>
			<div style="color:yellowgreen;">{{form.mc}}</div>
		</el-form>
		<el-button type="primary" class="submit" @click="submit">确定</el-button>
		<el-button type="danger"  class="submit" @click="cancel">取消</el-button>
	</el-dialog>
</template>

<script type="text/javascript">
	import qs from 'qs'
	export default {
		props: ['params'],
		data() {
			return {
				form: {
					mc:'',
					orderid:'',
					id:'',
					zt:1,
				},
			}
		},
		created() {
			console.log(this.params,999)
			if(this.params.row){
          	 	this.form.orderid=this.params.row.orderid;
			}else{
				this.form.orderid=this.params.orderid;
			}
//         this.loadinfo();
		},
		methods: {
			loadinfo(){
				var logininfo = JSON.parse(localStorage.logininfo);
                var params2 = qs.stringify({
                        xxid: logininfo.xxid,
						yhid: logininfo.id,
						orderid: this.form.orderid
               })
             //执行
                  this.axios.post(this.$store.state.api + 'order/getlqsp',  params2 )
                 .then(res => {
//               	console.log(res,'11111111111111')
					this.form = res.data.data.list[0]
                 }).catch(res => {
					 this.$message.warning("服务器异常");
					this.$emit('close', { type: 'info', cancel: true });
				})		
			},
			 submit() {
 				this.$store.state.loading = true;
 				//装载数据
 				var logininfo = JSON.parse(localStorage.logininfo);
 				var params2 = qs.stringify({
 						zt:'1',
 						orderid:this.form.orderid,
 						yhid: logininfo.id,
 						xxid: logininfo.xxid
 					})
 				//执行
 				    this.axios.post(this.$store.state.api + 'order/splq',  params2 )
 						.then(res => {
   							console.log(res,'1111111111111111')
 							if(res.data.code == 1) {
 								  this.$emit('close', { type: 'ly', cancel: true })
                                  this.$store.state.loading = false;
 							} else { 
 							      this.$message.warning(res.data.msg);
                                  this.$store.state.loading = false;
 							}
 						}).catch(res => {
 							this.$message.warning(res.data.msg);
 							this.$store.state.loading = false;
 						})
 			},
			cancel() {
				this.$emit('close', { type: 'ly', cancel: true })
			}
		}
	}
</script>

<style lang="less" scoped>
	.wrap {
		text-align: center;
	}
	.bt{
		position: absolute;
		width: 100%;
		height: 50px;
		margin: 0 auto;
		top: 0;
		left: 0;
		background: #50BFFF;
		color:white;
		text-align:left;
		line-height: 50px;
		font-size: 17px;
		padding-left: 15px;
	}
	.form {
		text-align: center;
		font-size:20px ;
		margin-bottom: 20px;
		margin-top: 10px;
		color:red;
	}
	 .input {
            width: 300px;
            display: inline-block;
        }

	.select-block {
		display: block;
	}

	.submit {
		width: 120px;
	}
</style>
